# myString <- "Hello, World!"
# print ( myString )

# # 列表包含向量、矩阵、列表
# list_data <- list(c("Google","Runoob","Taobao"), matrix(c(1,2,3,4,5,6), nrow = 2),
#    list("runoob",12.3))
# # 给列表元素设置名字
# names(list_data) <- c("Sites", "Numbers", "Lists")
# # 显示列表
# print(list_data)

# table = data.frame(
#     姓名 = c("张三", "李四"),
#     工号 = c("001","002"),
#     月薪 = c(1000, 2000)   
# )
# print(table) # 查看 table 数据

# # 数据准备
# info = c(1, 2, 4, 8)
# # 命名
# names = c("Google", "Runoob", "Taobao", "Weibo")
# # 涂色（可选）
# cols = c("#ED1C24","#22B14C","#FFC90E","#3f48CC")
# # 绘图
# pie(info, labels=names, col=cols)

# # 数据准备
# info = c(1, 2, 4, 8)
# # 命名
# names = c("Google", "Runoob", "Taobao", "Weibo")
# # 涂色（可选）
# cols = c("#ED1C24","#22B14C","#FFC90E","#3f48CC")
# # 计算百分比
# piepercent = paste(round(100*info/sum(info)), "%")
# # 绘图
# pie(info, labels=piepercent, main = "网站分析", col=cols, family='GB1')
# # 添加颜色样本标注
# legend("topright", names, cex=0.8, fill=cols)

# # 载入 plotrix
# library(plotrix)
# # 数据准备
# info = c(1, 2, 4, 8)
# # 命名
# names = c("Google", "Runoob", "Taobao", "Weibo")
# # 涂色（可选）
# cols = c("#ED1C24","#22B14C","#FFC90E","#3f48CC")
# # 设置文件名，输出为 png
# png(file = "3d_pie_chart.png")
# # 绘制 3D 图，family 要设置你系统支持的中文字体库
# pie3D(info,labels = names,explode = 0.1, main = "3D 图",family = "STHeitiTC-Light")

# # Create data for the graph.
# x <- c(21, 62, 10, 53)
# labels <- c("London", "New York", "Singapore", "Mumbai")
# # Give the chart file a name.
# png(file = "city.jpg")
# # Plot the chart.
# pie(x,labels)
# # Save the file.
# dev.off()

# Get the library.
library(plotrix)
# Create data for the graph.
x <-  c(21, 62, 10,53)
lbl <-  c("London","New York","Singapore","Mumbai")
# Give the chart file a name.
png(file = "3d_pie_chart.jpg")
# Plot the chart.
pie3D(x,labels = lbl,explode = 0.1, main = "Pie Chart of Countries ")
# Save the file.
dev.off()